package console;

import defaultPackage.Resources;;
public class Addresources implements Command{

	public Addresources()
	{
		
	}
	@Override
	public boolean check(String name) 
	{
		return "res".equals(name);
	}

	@Override
	public void run(String[] args) 
	{
		switch (args.length) {
		case 2:
			if(args[0].equals("set"))
			{
				System.out.println("seting resources to "+args[1]);
				Resources.setResources(Integer.parseInt(args[1]));
			}
			if(args[0].equals("add"))
			{
				System.out.println("adding resources by "+args[1]);
				Resources.setResources(Resources.getResources()+Integer.parseInt(args[1]));
				System.out.println("now you have "+Resources.getResources());
			}
			break;

		default:
			help();
			break;
		}
	}
	@Override
	public void disk() {
		// TODO Auto-generated method stub
		System.out.println("res       - set's resources");
	}
	@Override
	public void help() {
		// TODO Auto-generated method stub
		System.out.println("res set|add #amount");
	}

}
